package com.dailyblue.javaee.servlet;

import jakarta.servlet.*;

import java.io.IOException;
import java.io.PrintWriter;

public class SecondServlet extends GenericServlet {
    @Override
    public void service(ServletRequest req, ServletResponse resp) throws ServletException, IOException {
        System.out.println("我是SecondServlet的服务方法");
        //HttpServletResponse response = (HttpServletResponse) resp; // 向下转型
        // response.sendRedirect("1.jsp");
        // 设置响应的编码集
        resp.setContentType("text/html;charset=UTF-8");
        // 获取到out对象
        PrintWriter out = resp.getWriter();
        out.println("hello,world!");
        out.println("你好，世界");
    }
}